home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Alles Voor Internet / Tout Pour Internet
/
alles voor internet.iso
/
MacInternet™
/
Telnet
/
NCSA
/
tn3270 2.4d7 source
/
tn3270
/
switcher.c
< prev
next >
Wrap
Text File
|
1992-04-17
|
4KB
|
143 lines
/*
* tn3270 for the Macintosh Source Code
* Brown University Computing and Information Services
* Version 2.4d7 April, 1992
* Copyright (c) 1988, 1989, 1990, 1991, 1992 by Brown University and by
* Peter John DiCamillo.
*
* Permission is granted to any individual or institution to use, copy,
* or redistribute the binary version of this software and its
* documentation provided this notice and the copyright notices are
* retained. Permission is granted to any individual or non-profit
* institution to use, copy, modify, or redistribute the source files
* of this software provided this notice and the copyright notices are
* retained. This software may not be distributed for profit, either
* in original form or in derivative works, nor can the source be
* distributed to other than an individual or a non-profit institution.
* Any individual or group interested in seeing and/or using these
* source files but who are prevented from doing so by the above
* constraints should contact Don Wolfe, Assistant Vice-President for
* Computer Systems at Brown University, (401) 863-7250, for possible
* software licensing of the source developed at Brown.
*
* Brown University and Peter John DiCamillo make no representations
* about the suitability of this software for any purpose.
*
* BROWN UNIVERSITY AND PETER JOHN DICAMILLO GIVE NO WARRANTY, EITHER
* EXPRESS OR IMPLIED, FOR THE PROGRAM AND/OR DOCUMENTATION PROVIDED,
* INCLUDING, WITHOUT LIMITATION, WARRANTY OF MERCHANTABILITY AND
* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#if !defined(USEDUMP)
#include "maclib.h"
#include "termdef.h"
#include "tn3270funcs.h"
#include "globals.h"
#else
#pragma load "tn3270DumpFile"
#endif
GrafPtr suspend_gp;
void sw_suspend(long message)
{
WorldTable * wt;
cnr *cp;
suspend_gp = FrontWindow();
if (!sw_active()) { /* MultiFinder/System 7 suspend event */
mf_bgrnd = 1;
exportscrap(0);
if (mywindow(suspend_gp, &cp)) justGrowIcon(0, cp);
if (myxfwindow(suspend_gp, &cp)) xfGrowIcon(cp);
dfltcurs = 1;
SetCursor(normcurs);
return;
}
/* Switcher suspend event */
if (message & 0x00000020) /* convert private to desk scrap if needed */
exportscrap(0);
sw_bgrnd = 1; /* indicate backgound mode pending */
sw_upd = 0; /* reset update flag */
sw_beep = 0; /* reset beep flag */
wt = get_world(); /* install background routine */
wt->WTBgtask = (ProcPtr)bgproc;
}
void sw_resume(long message)
{
WorldTable * wt;
cnr * cp;
if (message & 0x00000002) importscrap();
dfltcurs = 1;
SetCursor(normcurs);
if (mf_bgrnd == 1) {
if (myxfwindow(suspend_gp, &cp)) {
SelectWindow(suspend_gp);
xfGrowIcon(cp);
}
mf_bgrnd = 0;
if (mywindow(suspend_gp, &cp)) {
if (cp->myWindow != 0) {
if (colormac && (!cp->cs.nocolor)) {
ActivatePalette(cp->myWindow);
updCTab(cp);
newbackcolor(cp);
}
justGrowIcon(0, cp);
invldscr(cp);
cp->cs.stat_time += 8; /* force time to be re-drawn */
newstat(cp);
chkpx(cp);
}
}
}
if (sw_bgrnd == 0) return;
sw_bgrnd = 0; /* indcate no longer in background */
wt = get_world(); /* de-install background routine */
wt->WTBgtask = 0;
if (sw_upd) { /* update for changes during background */
if (myxfwindow(suspend_gp, &cp)) xfGrowIcon(cp);
if (mywindow(suspend_gp, &cp)) {
if (cp->myWindow != 0) {
justGrowIcon(0, cp);
invldscr(cp);
newstat(cp);
chkpx(cp);
}
}
}
if (sw_beep) beep(cp);
}
Boolean sw_active(void) /* tell caller if we're under Switcher */
{
static long * sw_globals = (long *)0x282;
if ((*sw_globals) == 0) return(0);
if ((*sw_globals) == -1) return(0);
return(1);
}
WorldTable * get_world(void)
{
static unsigned long * ApplZone = (unsigned long *)0x2aa;
return((WorldTable *)((*ApplZone) - 18));
}
void sw_proc(void) /* called as background process */
{
if (haveserial) serevent();
else if (havetcp) tcpevent();
else if (havesa) saevent();
}